package cn.qhuan.modules.dtos;

import cn.qhuan.modules.dtos.PageRequestDto;
import lombok.Data;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 展厅时间dto
 * @Author: 司翔宇
 * @Date:   2020-12-23
 */
@Data
public class ExhiTimeDto extends PageRequestDto {

    public static String getNowTime(){

        SimpleDateFormat sdf =new SimpleDateFormat("yyyy年MM月dd日");
        return sdf.format(new Date());

    }
    public static Date getDate(String date)  {
        SimpleDateFormat sdf =new SimpleDateFormat("yyyy年MM月dd日");
        Date parse = null;
        try {
             parse = sdf.parse(date);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return parse;
    }
    public static Long getTime(String date){
        SimpleDateFormat sdf =new SimpleDateFormat("yyyy年MM月dd日");
        long time =0;
        try {
             time = sdf.parse(date).getTime();

        } catch (ParseException e) {
            e.printStackTrace();
        }
        return time;
    }
}
